<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="../../../vue.js"></script>
    <title>Document</title>
    <style>
      .box {
        width: 200px;
        height: 200px;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <!-- 绑定style对象的写法 -->
      <div class="box" :style="{background:isRed?'red':'yellow'}"></div>
    </div>
    <script>
      const vm = new Vue({
        el: '#app',
        data() {
          return {
            isRed: true,
          };
        },
      });
    </script>
  </body>
</html>
